//
//  LMCover.m
//  李明微博
//
//  Created by 张青花 on 15/12/4.
//  Copyright (c) 2015年 李明. All rights reserved.
//

#import "LMCover.h"

@implementation LMCover


- (void)setDimBackground:(BOOL)dimBackground
{
    _dimBackground = dimBackground;
    
    if (dimBackground) {
        self.backgroundColor = [UIColor blackColor];
        self.alpha = 0.5;
    }
    else
    {
        self.alpha = 1;
        self.backgroundColor = [UIColor clearColor];
    }
}

+ (instancetype)show
{
    LMCover *cover = [[LMCover alloc] initWithFrame:[UIScreen mainScreen].bounds];
    
    cover.backgroundColor = [UIColor clearColor];
    
    [LMKeyWindow addSubview:cover];
    
    
    return cover;
}


- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self removeFromSuperview];
    
    if ([_delegate respondsToSelector:@selector(coverDidClickCover:)]) {
        [_delegate coverDidClickCover:self];
    }
}
@end
